<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
<%@page import="java.util.Date"%>
<%@page import="java.util.List"%>
<%@page import="feedme.dao.*"%>
<%@page import="feedme.bean.*"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.web.jsf.el.WebApplicationContextFacesELResolver"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>

<%
String title = "选择食品提供商";

WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getServletContext());
DaoFactory daoFactory = ctx.getBean("mongoDaoFactory", DaoFactory.class);

FoodServerDao fsDao = daoFactory.getFoodServerDaoInstance();
List<?> foodServerList = fsDao.findAll();

%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=title%></title>
</head>
<body>
	<form action="order_moddo.jsp?act=add&type=fs" method="post">
		<div>
        <select name="fsId">
        <% for(int i = 0 ; i < foodServerList.size() ; i++) { %>
            <% FoodServerBean record = (FoodServerBean)foodServerList.get(i);  %>
            <option value="<%= record.getObjId() %>" >
                <%= record.getName() %> 
            </option> 
        <% } %>
        </select>
        </div>
        <div>
            <input type="submit" name="submit" value="今天吃这家" />
        </div>
    </form>
    
    <form action="foodserver_moddo.jsp?act=del" method="post">
        <div>
        <select name="fsId">
        <% for(int i = 0 ; i < foodServerList.size() ; i++) { %>
            <% FoodServerBean record = (FoodServerBean)foodServerList.get(i);  %>
            <option value="<%= record.getObjId() %>" >
                <%= record.getName() %> 
            </option> 
        <% } %>
        </select>
        </div>
        <div>
            <input type="submit" name="submit" value="删除" />
        </div>
    </form>

    <form action="foodserver_moddo.jsp?act=add" method="post">
        <div>
            <input type="text" name="name" value="Buzz咖喱" />
		</div>
		<div>
            <input type="text" name="tel" value="15201971679" />
        </div>
		<div>
		    <input type="submit" id="submit" value="增加" />
		</div>
	</form>
	

</body>
</html>
